package com.example.as.Service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.as.entity.ChatMessage;
import com.example.as.entity.Record;
import com.example.as.Mapper.RecordMapper;
import com.example.as.Service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.util.List;

@Service
public class RecordServiceImpl extends ServiceImpl<RecordMapper, Record> implements RecordService {

    @Autowired
    RecordMapper recordMapper;

    @Override
    public int addRecord(Record record) {
        return recordMapper.addRecord(record.getTimeStamp(), record.getSender(), record.getReceiver(), record.getMessage(), record.getMessageType());
    }

    @Override
    public List<ChatMessage> getHistoryList(Timestamp time_stamp){
        return recordMapper.getHistoryList(time_stamp);
    }

    @Override
    public List<ChatMessage> getAllHistoryList(){
        return recordMapper.getAllHistoryList();
    };
}
